////package com.javabasic;
////
/////**
//// * @author mir.xiong
//// * @version 1.0
//// * @description
//// * @see
//// * @since Created by work on 2022/1/4 8:20 下午
//// */
////public class TestOne {
////
////    public static void main(String[] args) {
////        CustomStack customStack = new CustomStack(3);
////        customStack.put(1);
////        customStack.put(4);
////        customStack.put(7);
////        System.out.println(customStack.get());
////        customStack.put(8);
////        System.out.println(customStack.get());
////        customStack.put(8);
////        customStack.put(8);
////        System.out.println(customStack.get());
////    }
////
////}
////
////class CustomStack {
////    private int sum;
////    private int cap;
////    private int[] data;
////    private int checkPoint;
////    private boolean cycle;
////
////    public CustomStack(int cap) {
////        init(cap);
////    }
////
////
////    public void init(int cap) {
////        this.cap = cap;
////        data = new int[cap];
////        checkPoint = 0;
////        sum = 0;
////        cycle = false;
////    }
////
////    public void put(int element) {
////        if (checkPoint >= cap) {
////            checkPoint = 0;
////            cycle = true;
////        }
////
////        if (cycle) {
////            sum -= data[checkPoint];
////        }
////
////        sum += element;
////        data[checkPoint++] = element;
////    }
////
////    public int get() {
////        if (cycle) {
////            return sum / cap;
////        } else {
////            return sum / checkPoint;
////        }
////    }
////}
//
//
//
//# // 1. 合并两个已经有序的数组，结果放在第一个数组中，第一个数组假设空间足够大（刚好可以放下所有数）。要求算法时间复杂度尽可能低。
//
//        # // Input:
//        # // nums1 = [1,2,3,0,0,0], m = 3
//        # // nums2 = [2,5,6],       n = 3
//
//        # // Output: [1,2,2,3,5,6]
//
//public static void mergeArray(int[] arr1, int[] arr2) {
//        int len1 = arr1.length;
//        int len2 = arr2.length;
//        int tag = len2-1;
//        for (int i = len1-1; tag >= 0; i--) {
//        arr1[i] = arr2[tag--];
//        }
//
//
//        quickSort(arr1,0,len1-1);
//
//        }
//
//public static void quickSort(int[] nums, int left, int right) {
//        if (left < right) {
//        int tag = executeSort(nums,left,right);
//        quickSort(nums,left,tag-1);
//        quickSort(nums,tag+1, right);
//        }
//        }
//
//private static int executeSort(int[] nums, int left, int right) {
//        int tagNum = nums[left];
//        while (left < right) {
//        while (nums[right] > tagNum && right > left) {
//        right--;
//        }
//        nums[left] = nums[right];
//        while (nums[left] <= tagNum && right > left) {
//        left++;
//        }
//        nums[right] = nums[left];
//        nums[left] = tagNum;
//        }
//        return left;
//        }
//
////2、商城推出折上满减活动：“活动商品7.7折，折后若满 399.99 再减 99.99 活动”，参加活动的商品每类最多能买两件，商品列表如下：
////       商品A   9.99元
////       商品B   19.99元
////       商品C   99.99元
////       商品D  199.99元
////       商品E   299.99元
////      请使用Java实现如下程序：计算所有符合 折后再减 条件的商品类组合，并按最终成交价格由低到高输出这些组合。
//
//static List<Double> result;
//static double[] price = new double[]{9.99,19.99,99.99,199.99,299.99};
//
//public static void main(String[] args) {
//
//        int PRICE_LEN = 5;
//        result = new ArrayList<>();
//
//        dfs(PRICE_LEN-1, 0);
//        Collections.sort(result);
//
//        System.out.println(result.size());
//        for (Double sum : result) {
//        System.out.print(sum + " ");
//        }
//        }
//
//private static void dfs(int i, double sum) {
//
//        if (i < 0) {
//        sum = sum * 0.77;
//        if (sum-399.99 >= 0.000001) {
//        sum -= 99.99;
//        }
//        result.add(sum);
//        return;
//        }
//
//        dfs(i-1,sum);
//        dfs(i-1,sum + price[1]);
//        dfs(i-1,sum+ price[1]*2);
//        }
